const Question = require("../model/question.model");
const Topic = require("../model/topic.model");

class QuestionService {
  async getQuestionBank() {
    const res = await Question.findAll({
      attributes: {
        exclude: ["createdAt", "updatedAt"],
      },
    });
    return res ? res : null;
  }

  async create(question_mes) {
    const res = await Question.create(question_mes);
    return res.dataValues;
  }

  async deleteMyQuestion(id) {
    const res = await Question.destroy({
      where: {
        id: id,
      },
    });
    return res.dataValues;
  }
}

module.exports = new QuestionService();
